import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    // authLevel: 0,
    ownerId: '',
    account: '',
    storeId: '',
    storeName: '',
    // coId: 0,
    isLogin: 'false',
  },
  getters: {},
  // 改变state里面的值得方法
  mutations: {
    setAccount(state, account) {
      state.account = account;
    },
    setOwnerId(state, ownerId) {
      state.ownerId = ownerId;
    },
    // setAuthLevel(state, authLevel) {
    //   state.authLevel = authLevel;
    // },
    setStoreId(state, storeId) {
      state.storeId = storeId;
    },
    setStoreName(state, storeName) {
      state.storeName = storeName;
    },
    // setCoId(state, coId) {
    //   state.coId = coId;
    // },
    setLogin(state, isLogin) {
      state.isLogin = isLogin;
    },
  },
  actions: {
    set_account(set, account) {
      set.commit('setAccount', account);
    },
    set_ownerId(set, ownerId) {
      set.commit('setOwnerId', ownerId);
    },
    // set_authLevel(set, authLevel) {
    //   set.commit('setAuthLevel', authLevel);
    // },
    set_storeId(set, storeId) {
      set.commit('setStoreId', storeId);
    },
    set_storeName(set, storeName) {
      set.commit('setStoreName', storeName);
    },
    // set_coId(set, coId) {
    //   set.commit('setCoId', coId);
    // },
    set_Login(set, isLogin) {
      set.commit('setLogin', isLogin);
    },
  },
  modules: {},
});
